/*
 * @Author: guandeshen 295570679@qq.com
 * @Date: 2024-05-11 21:09:19
 * @LastEditors: guandeshen 295570679@qq.com
 * @LastEditTime: 2024-08-31 00:05:57
 * @FilePath: /task-admin/src/views/assets-list/config/content.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
import AssetssaleAPI from "@/api/assetssale";
import type { AssetssaleQuery } from "@/api/assetssale/model";
import type { IContentConfig } from "@/components/PageContent/index.vue";
import i18n from "@/lang/index";

const contentConfig: IContentConfig<AssetssaleQuery> = {
  tagList: [],
  searchbar: ["add"],
  searchPlaceholder: i18n.global.t("common.searchPlaceholder"),
  hasDashData: false,
  pageName: i18n.global.t("route.assets"),
  tableName: "",
  table: {
    highlightCurrentRow: true,
  },
  indexAction: function (params) {
    // console.log("%c Line:42 🥖 params", "color:#ed9ec7", params);
    // if ("createAt" in params) {
    //   const createAt = params.createAt as number[];
    //   params.project_id = createAt[0];
    //   params.site_id = createAt[1];
    //   delete params.createAt;
    // }
    return AssetssaleAPI.getPage(params);
  },
  deleteAction: AssetssaleAPI.deleteByIds,
  pk: "id",
  toolbar: [
    "refresh",
    "add",
    "delete",
    // "export",
    // {
    //   name: "import",
    //   icon: "upload",
    //   text: i18n.global.t("common.import"),
    //   auth: "import",
    // },
  ],
  cols: [
    // { type: "selection", width: 50, align: "center" },
    {
      label: i18n.global.t("common.productName"),
      align: "left",
      prop: "asset_name",
      tooltip: true,
      minWidth: 140,
    },
    {
      label: i18n.global.t("common.supplier"),
      align: "left",
      prop: "supplier_name",
      tooltip: true,
      minWidth: 120,
    },
    {
      label: i18n.global.t("common.contactInformation"),
      align: "left",
      prop: "supplier_contact",
      tooltip: true,
      minWidth: 120,
    },
    {
      label: i18n.global.t("common.unit"),
      align: "left",
      prop: "asset_unit",
      tooltip: true,
      minWidth: 120,
    },
    {
      label: i18n.global.t("common.unitPrice"),
      align: "right",
      prop: "asset_unit_price",
      tooltip: true,
      minWidth: 120,
    },
    {
      label: i18n.global.t("common.stock"),
      align: "right",
      prop: "asset_qty",
      tooltip: true,
      minWidth: 120,
    },
    {
      label: i18n.global.t("common.warningThreshold"),
      align: "right",
      prop: "waring_threshold",
      tooltip: true,
      minWidth: 180,
    },
    {
      label: i18n.global.t("common.status"),
      align: "left",
      prop: "status",
      slotName: "status",
      templet: "custom",
      width: 140,
    },
    {
      label: i18n.global.t("common.remark"),
      align: "left",
      prop: "remark",
      tooltip: true,
      minWidth: 140,
    },
    {
      label: i18n.global.t("common.creator"),
      align: "left",
      prop: "created",
      tooltip: true,
      minWidth: 120,
    },
    {
      label: i18n.global.t("common.operation"),
      fixed: "right",
      align: "center",
      width: 200,
      templet: "tool",
      operat: ["edit", "delete"], //"edit",
      // operat: ["edit", "delete", "addstock"], //"edit",
    },
  ],
};

export default contentConfig;
